<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script src="../static/vue.js"></script>
<script src="../static/axios.js"></script>
<script src="../static/util.js"></script>
<body>
<div id="app">
    姓名：
    <input type="text" name="name" v-model="pojo.name"><br>
    性别：
    <input type="radio" name="gender" v-model="pojo.gender" value="男">男
    <input type="radio" name="gender" v-model="pojo.gender" value="女">女<br>
    密码：
    <input type="password" name="password" v-model="pojo.password"><br>
    年龄：
    <input type="text" name="age" v-model="pojo.age"><br>
    电话：
    <input type="tel" name="tel" v-model="pojo.tel"><br>
    <button type="button" @click="submit()">修改</button>
</div>
</body>
<script>
    new Vue({
        el: "#app",
        data: {
            pojo: {}
        },
        created() {
            this.findById()
        },
        methods: {
            findById(id) {
                axios.post("http://localhost:8080/sys/user/findById?id="+getQueryString("id")).then(
                    res => {
                        this.pojo = res.data;
                    }
                )
            },
            submit() {
                axios.post("http://localhost:8080/sys/user/update", this.pojo).then(
                    res => {
                        location.href = "user.html"
                    }
                )
            }
        }
    })
</script>
</html>